package com.sc.nft.entity.vo;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.sc.nft.enums.props.reward.RewardDetailStatusEnum;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;

public class RewardDetailStatusEnumConverter implements Converter<RewardDetailStatusEnum> {

    @Override
    public Class<RewardDetailStatusEnum> supportJavaTypeKey() {
        return RewardDetailStatusEnum.class;
    }

    @Override
    public WriteCellData<?> convertToExcelData(RewardDetailStatusEnum value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        if (value != null) {
            return new WriteCellData<>(value.getDesc());
        }
        return new WriteCellData<>("");
    }

    @Override
    public RewardDetailStatusEnum convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        // 这里可以实现从Excel读取时的转换逻辑
        return null; // 根据需要实现
    }
}